<template>
    <div class="danger">
        <el-row>
            <el-col :span="4">
                <div id="u10249" style="cursor: pointer;">
                    全部隐患
                </div>
            </el-col>
            <el-col :span="4">
                <div id="u10250" style="cursor: pointer;">
                    待审核
                </div>
            </el-col>
            <el-col :span="4">
                <div id="u10250" style="cursor: pointer;">
                    待处理
                </div>
            </el-col>
            <el-col :span="4">
                <div id="u10250" style="cursor: pointer;">
                    待验证
                </div>
            </el-col>
            <el-col :span="4">
                <div id="u10250" style="cursor: pointer;">
                    已完成
                </div>
            </el-col>
            <el-col :span="4">
                <div id="u10250" style="cursor: pointer;">
                    我的
                </div>
            </el-col>
        </el-row>
        <el-form :inline="true" :model="findConditionDanger" class="menu-form-inline">
            <el-row style="margin-top:15px;">
                <el-form-item>
                    <el-select placeholder="隐患状态" size="mini">
                        <el-option>全部</el-option>
                        <el-option>待审核</el-option>
                    </el-select>
                </el-form-item>

                <el-form-item>
                    <el-select placeholder="隐患级别" size="mini">
                        <el-option>全部</el-option>
                        <el-option>重大隐患</el-option>
                        <el-option>一般隐患</el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-select placeholder="隐患来源" size="mini">
                        <el-option>全部</el-option>
                        <el-option>监控上报</el-option>
                        <el-option>保安上报</el-option>
                    </el-select>
                </el-form-item> <el-form-item>
                    <el-select placeholder="隐患类型" size="mini">
                        <el-option>全部</el-option>
                        <el-option>校园三防建设</el-option>
                        <el-option>校园食品卫生</el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-input v-model="input" placeholder="隐患上报人" size="mini" style="width: 120px;"></el-input>
                </el-form-item>
                <el-button type="primary">查询</el-button>
                <el-button>重置</el-button>
            </el-row>
            <el-row style="margin-top:0px;">
                <!-- <el-form-item>
                    <el-date-picker type="datetimerange" start-placeholder="上报日期" end-placeholder="上报日期"
                        :default-time="['12:00:00']" size="large" style="width: 240px;">
                    </el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-date-picker type="datetimerange" start-placeholder="结束日期" end-placeholder="结束日期"
                        :default-time="['12:00:00']" size="large" style="width: 240px;">
                    </el-date-picker>
                </el-form-item> -->
            </el-row>
        </el-form>
        <el-row>
            <el-button type="text" @click="add">上报隐患</el-button>
        </el-row>
        <el-row>
            <el-col :span="24">
                
            </el-col>
        </el-row>
        <el-dialog title="上报隐患" :visible.sync="dialogFormVisible">
            <el-form :model="escalationDanger">
                <el-form-item label="隐患名称" :label-width="formLabelWidth">
                    <el-input v-model="escalationDanger.dangerName" style="width: 240px;" placeholder="隐患名称"></el-input>
                </el-form-item>
                <el-form-item label="隐患类型" :label-width="formLabelWidth">
                    <el-select v-model="escalationDanger.dangerType" placeholder="隐患类型">
                        <el-option label="校园三防建设" value="校园三防建设"></el-option>
                        <el-option label="校园食品卫生" value="校园食品卫生"></el-option>
                        <el-option label="校园消防安全" value="校园消防安全"></el-option>
                        <el-option label="体艺设施设备" value="体艺设施设备"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="隐患地点" :label-width="formLabelWidth">
                    <el-input v-model="escalationDanger.locale" style="width: 240px;" placeholder="隐患名称"></el-input>
                </el-form-item>
                <el-form-item label="隐患描述" :label-width="formLabelWidth">
                    <el-input v-model="escalationDanger.dangerDescribe" :rows="5" type="textarea" placeholder="隐患描述">
                    </el-input>
                </el-form-item>
                <el-form-item label="是否处理" :label-width="formLabelWidth">
                    <el-select v-model="escalationDanger.handleState" placeholder="处理状态">
                        <el-option label="已处理" value="1"></el-option>
                        <el-option label="未处理" value="0"></el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="toAddDanger">确 定</el-button>
            </div>
        </el-dialog>

    </div>
</template>

<script>
import axios from "axios";
import 'element-ui/lib/theme-chalk/display.css';
export default {
    data() {
        return {
            data: [],
            findConditionDanger: {
                examineState: '',
                dangerLevel: '',
                dangerSource: '',
                dangerType: '',
                escalationName: ''
            },
            dialogFormVisible: false,
            escalationDanger: {
                dangerId: '',
                dangerName: '',
                dangerType: '',
                locale: '',
                handleState: ''
            },
        }
    },
    methods: {
        //   新增
        add() {
            this.dialogFormVisible = true;
        },
        toAddDanger() {
            console.log(this.addDanger)
            axios.post("/api/manager/danger/addDanger", this.addDanger)
                .then((res) => {
                    console.log(res)
                    if (res.data.code == 200) {
                        this.$message({
                            message: '恭喜你，' + res.data.message,
                            type: 'success'
                        });
                        this.dialogFormVisible = false;
                        this.searchUserList();
                    } else {
                        this.$message.error('错了哦，' + res.data.message);
                    }
                }
            )
        }

    }
}
</script>

